function Konvertera(a_text)
{
    var original = a_text;
    
	// Change all upper- and lower-case 'a' to #.
	a_text = a_text.replace(/a/gi, "#");
	
	a_text = ReplaceCharacters(a_text);
	
	// Present the result.
    document.getElementById("result").innerHTML="Original: " + original + "<br/>" + "New String: " + a_text;
	
	return a_text;
}


function ReplaceCharacters(a_text)
{
	var ret = "";
	
	// Go through all characters in the string.
	for (i = 0; i < a_text.length; i++)
	{
		if (CharIsUpperCase(a_text.charAt(i)))
		{
			// add the lower-case character to the ret-string.
			ret += a_text.charAt(i).toLowerCase();
		}
		else
		{
			// add the upper-case character to the ret-string.
			ret += a_text.charAt(i).toUpperCase();
		}
	}
	
	return ret;
}

function CharIsUpperCase(a_char)
{
	if (a_char == a_char.toUpperCase())
	{
		return true;
	}
	return false;
}